<?php


namespace api\controllers;


use api\components\BaseController;
use common\models\User;
use common\models\UserCoupon;
use Yii;

class UserController extends BaseController
{
    /**
     * 获取用户信息
     * @return array
     */
    public function actionInfo()
    {
        $userid = self::$userid;
        $model = new User();
        return $model->getInfo($userid);
    }

    /**
     * 我的券
     * @return array
     */
    public function actionCoupon()
    {
        $get = Yii::$app->request->get();
        $page = $get['page']??1;
        $use = $get['use']??'';
        $is_buy = $get['is_buy']??'';
        return (new UserCoupon())->getUserList(self::$userid,$page,$this->campus_id,$use,$is_buy);
    }
}